import React, { Component } from 'react'
import { Route, NavLink, Switch, Redirect,Link } from "react-router-dom"
import   style from "./center.module.css"
import router from "../../router"
import Foot from "../../components/foot_router/foot_router"
export default class Center extends Component {


    render() {
        return (
            <div>
                <h2>咨询首页</h2>
       <div className={style.main}>
       <ul className={style.name}>
            {
              router[2].children.filter(item=>!item.show).map(item => <li key={item.path}>
                <NavLink
                  className={style.li}
                  activeClassName={style.active}
                  to={{ pathname: item.path }}>
                  <span>{item.til}</span>
                </NavLink>
              </li>)
            }

          </ul>
       </div>
         
          <Switch>
            {

              router[2].children.map((item, i) => <Route
                key={i}
                path={item.path}
                render={() => {
                  return <item.component />
                }}></Route>)
            }
             <Redirect to="/center/ask" />
          </Switch>
            <Foot/>
            </div>
        )
    }
}

